package com.hinata.hinataimageloader;

import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by Hinata on 2017/4/15.
 */

public class RecyclerViewHoder extends ViewHolder implements OnClickListener {

    public ImageView iv;
    private RecyclerViewItemClickListener mListener;

    public RecyclerViewHoder(View rootView,RecyclerViewItemClickListener listener) {
        super(rootView);
        iv = (ImageView)rootView.findViewById(R.id.id_index_gallery_item_image);
        this.mListener = listener;
        rootView.setOnClickListener(this);
    }

    /**
     * 点击监听
     */
    @Override
    public void onClick(View v) {
        if(mListener != null){
            mListener.onItemClick(v,getPosition());
        }
    }
}
